package com.example.websocket.handler;

import org.springframework.web.socket.WebSocketHandler;
import org.springframework.web.socket.WebSocketSession;
import org.springframework.web.socket.server.HandshakeHandler;
import org.springframework.web.socket.server.HandshakeInterceptor;
import org.springframework.web.socket.server.support.DefaultHandshakeHandler;

public interface RegisterWebSocketHandler extends WebSocketHandler{
    HandshakeInterceptor[] emptyInterceptor = new HandshakeInterceptor[0];
    String[] allowedAll =  new String[]{"*"};

    String[] paths();
    default String getUniqueCode(WebSocketSession session) {
        return session.getId();
    }


   default HandshakeHandler handshakeHandler() {
       return new DefaultHandshakeHandler();
   }


    default int order() {
        return 0;
    }

    default HandshakeInterceptor[] interceptors() {
        return emptyInterceptor;
    }

    default String[] allowedOrigins(){
        return allowedAll;
    }
}
